import store from './storage'

const TOKEN_KEY = '__token__'
const PHONE_KEY = '__phone__'
const USERINFO_KEY = '__userInfo__'
const CATEGORY_KEY = '__category__'
const HOT_SERIES_KEY = '__category__'
const USER_NAME = '__username__'

export function setToken (info) {
  store.set(TOKEN_KEY, info)
  return info
}

export function getToken () {
  return store.get(TOKEN_KEY)
}

export function removeToken () {
  store.remove(TOKEN_KEY)
}

export function setPhone (info) {
  store.set(PHONE_KEY, info)
  return info
}

export function getPhone () {
  return store.get(PHONE_KEY)
}

export function setUsername (info) {
  store.set(USER_NAME, info)
  return info
}

export function getUsername () {
  return store.get(USER_NAME)
}

export function setUserInfo (info) {
  store.set(USERINFO_KEY, info)
  return info
}

export function getUserInfo () {
  return store.get(USERINFO_KEY)
}

export function setCategories (info) {
  store.session.set(CATEGORY_KEY, info)
  return info
}

export function getCategories () {
  return store.session.get(CATEGORY_KEY)
}

export function setHotSeries (info) {
  store.session.set(HOT_SERIES_KEY, info)
  return info
}

export function getHotSeries () {
  return store.session.get(HOT_SERIES_KEY)
}
